<?php session_start(); ?>
<?php include("../inc/db_config.inc"); ?>
        <?php
if(isset($_REQUEST['pid'])){
	$pid=$_REQUEST['pid'];
    $result_arc=mysql_query("select i.id as aid,i.title,i.created,i.pubid,i.content,i.allowComment,i.comment_audit,t.name,t.id from info as i,type as t where i.type=t.id and i.id='$pid'");
    $row_arc=mysql_fetch_array($result_arc);
    $g_title=$row_arc['title'];
    $affect_row=mysql_affected_rows();
}
?>
<?php 
$g_title="编辑文章";
$g_tab="index";
$g_header=""; 
$g_js='<script type="text/javascript" src="../editor/kindeditor.js"></script> 
<script type="text/javascript">
var a="xiaoshan"; 
KE.show({
                id : "Content",
                skinType:"default",
                allowUpload:true,
                allowFileManager:false
        });
$(document).ready(function(){
    $("#catalog_addbtn").click(function(){
    $("#catalog_add").show();
    })
    $("#cataCancel").click(function(){
        $("#catalog_add").hide();
    })
})
</script>';
?>
 <?php include('header.php'); ?>
			<div class="crumb"></div>
			<div class="main">
				<div class="container r">
					<div class="conbox">
						<div class="cb_hd">
							<span class="cb_tl"></span>
							<span class="cb_tr"></span>
							<h2>编辑文章</h2>
						</div>
						<div class="cb_bd">
								<form class="sendbox" action="post_edit_action.php" method="post">
                                <input type="hidden" name="pid" value="<?php echo $pid; ?>" />
									<p>
										<label>标题:</label><input name="title" class="txt" type="text" value="<?php echo $row_arc['title']; ?>"/>
									</p>
									<p>
										<label>分类:</label>
                                        <select name="type">
                                        <option value="">请选择</option>
                                        <?php
                                         $result_type=mysql_query("select * from type");
                                         while($row_type=mysql_fetch_array($result_type)){
                                         ?>
                                            <option value="<?php echo $row_type['id']; ?>" <?php if($row_arc['name']==$row_type['name']) echo "selected=selected"; ?>><?php echo $row_type['name']; ?></option>
                                            <?php } ?>
                                        </select>
                                        <a id="catalog_addbtn" href="javascript:void(0)">添加分类</a>
                                        <div id="catalog_add" class="dn"><input type="text"/><input type="button" value="确定" /><input id="cataCancel" type="button" value="取消" /></div>
									</p>
                                    <p>
										<label>是否允许评论:</label><input  name="allowComment" <?php if($row_arc['allowComment']==1) echo "checked=checked"; ?> value="1" type="radio"/>是 <input <?php if($row_arc['allowComment']==0) echo "checked=checked"; ?> name="allowComment" value="0" type="radio"/>否
									</p>
                                    <p>
										<label>评论是否需要审核:</label><input  name="commentAudit" <?php if($row_arc['comment_audit']==1) echo "checked=checked"; ?> value="1" type="radio"/>是 <input name="commentAudit" <?php if($row_arc['comment_audit']==0) echo "checked=checked"; ?> value="0" type="radio"/>否
									</p>
									<p>
										<label>内容:</label><div style="margin-left: 25px;"><textarea id="Content" name="content"><?php echo stripslashes($row_arc['content']); ?></textarea></div>
									</p>
                                    
									<p>
										<input class="sub" type="submit" value="提交"/>
									</p>
								</form>
						</div>
						<div class="cb_ft"></div>
					</div>
				</div>
				<?php include('sidebar.php'); ?>
				<div class="c"></div>
			</div>
		</div>
	</div>
<?php include('footer.php'); ?>
